package com.innerchic.mapper.app;

import android.app.Application;

import com.innerchic.mapper.resfind.ResFind;

/**
 * ================================================
 * 作    者：贾恒飞 >>> 17515250730@163.com
 * 项    目：young
 * 日    期：2021/11/2 10:33
 * 包    名：com.innerchic.mapper.app
 * 描    述：顶层活动
 * Create by zFox from AndroidStudio4.2
 * ================================================
 */
public abstract class SuperApplication extends Application {

    public static SuperApplication application;

    public static SuperApplication getApplication() {
        return application;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        application = this;

        onApplicationCreate();

        //尝试初始资源
        String myPackageName = getMyPackageName();
        if (myPackageName != null && !"".equals(myPackageName)) {
            ResFind.getInstance().init(myPackageName);
        }

    }

    /**
     * 执行子类初始化方法
     */
    protected abstract void onApplicationCreate();

    /**
     * 获取包名
     *
     * @return null或空字符串无意义
     */
    public abstract String getMyPackageName();

}
